<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>
        文章添加
    </title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">

    <link rel="stylesheet" href="/static/css/x-admin.css" media="all">

    <!--<style>
        .imgs{display: none;}
        .picture{display: none;}
    </style>-->

    <!--百度编辑器-->
    <script src="/static/ueditor/ueditor.config.js"></script>
    <script src="/static/ueditor/ueditor.all.min.js"></script>
    <script src="/static/ueditor/lang/zh-cn/zh-cn.js"></script>
</head>
<body>
<div class="x-nav">
            <span class="layui-breadcrumb">
              <a><cite>首页</cite></a>
              <a><cite>招标管理</cite></a>
              <a><cite>招标详情</cite></a>
            </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"  href="javascript:location.replace(location.href);" title="刷新"><i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>
<div class="x-body">
    <form class="layui-form layui-form-pane" action="" id="add">
        <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
            <ul class="layui-tab-title">
                <li class="layui-this">基本信息</li>
                <li>状态信息</li>
                <li>文章内容</li>
            </ul>

            <div class="layui-tab-content" >
                <div class="layui-tab-item layui-show">
                    <!--<form class="layui-form layui-form-pane" action="" id="add">-->
                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            排序
                        </label>
                        <div class="layui-input-block">
                            <input type="text" autocomplete="off" class="layui-input" value="{$info['id']}" disabled>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            招标名称
                        </label>
                        <div class="layui-input-block">
                            <input type="text" autocomplete="off" class="layui-input" value="{$info['title']}" disabled>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            所属类目
                        </label>
                        <div class="layui-input-block">
                            <input type="text" autocomplete="off" class="layui-input" value="{$info['catename']} - {$info['catepidname']}" disabled>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            投标人姓名
                        </label>
                        <div class="layui-input-block">
                            {if condition="$info.name eq ''"}
                            <input type="text" autocomplete="off" class="layui-input" value="暂无人投标" disabled>
                            {else}
                            <input type="text" autocomplete="off" class="layui-input" value="{$info['name']}" disabled>
                            {/if}
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            手机号
                        </label>
                        <div class="layui-input-block">
                            {if condition="$info.phone eq ''"}
                            <input type="text" autocomplete="off" class="layui-input" value="暂无人投标" disabled>
                            {else}
                            <input type="text" autocomplete="off" class="layui-input" value="{$info['phone']}" disabled>
                            {/if}
                        </div>
                    </div>

                    <!--</form>-->
                    <div style="height:100px;"></div>
                </div>
                <div class="layui-tab-item">
                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            发布时间
                        </label>
                        <div class="layui-input-block">
                            <input type="text" autocomplete="off" class="layui-input" value="{$info['time']}" disabled>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            截止时间
                        </label>
                        <div class="layui-input-block">
                            <input type="text" autocomplete="off" class="layui-input" value="{$info['times']}" disabled>
                        </div>
                    </div>
                    <!--  <form class="layui-form layui-form-pane" action="" id="add">-->
                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            <span class='x-red'>*</span>状态
                        </label>
                        <div class="layui-input-block">
                            {if condition="$info.state eq 1"}
                                <input type="radio" name="status" value="1" title="启用" checked disabled>
                                <div class="layui-unselect layui-form-radio layui-form-radioed"><i class="layui-anim layui-icon layui-anim-scaleSpring"></i>
                                    <div>启用</div>
                                </div>
                            {else}
                                <input type="radio" name="status" value="0" title="禁用" checked disabled>
                                <div class="layui-unselect layui-form-radio"><i class="layui-anim layui-icon"></i>
                                    <div>禁用</div>
                                </div>
                            {/if}
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            价格
                        </label>
                        <div class="layui-input-block">
                            <input type="text" autocomplete="off" class="layui-input" value="￥{$info['price']}" disabled>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            投标数
                        </label>
                        <div class="layui-input-block">
                            <input type="text" autocomplete="off" class="layui-input" value="{$info['number']}" disabled>
                        </div>
                    </div>

                    <!--</form>-->
                </div>
                <div class="layui-tab-item">
                    <!-- <form class="layui-form layui-form-pane" action="" id="add">-->
                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">
                            <span class='x-red'>*</span>需求描述
                        </label>
                        <div class="layui-input-block">
                            {if condition="$info.describe eq ''"}
                                <textarea disabled class="layui-textarea">无</textarea>
                            {else}
                                <textarea disabled class="layui-textarea">{$info['describe']}</textarea>
                            {/if}
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            附件
                        </label>
                        <div class="layui-input-block">
                            {if condition="$info.file eq ''"}
                                <input class="layui-btn layui-btn-primary layui-border-blue" type="button" value="无">
                            {else}
                                <input class="layui-btn layui-btn-primary layui-border-blue" type="button" value="{$info['file']}">
                            {/if}
                        </div>
                    </div>
                    <!--</form>-->
                </div>

            </div>

        </div>
    </form>
</div>
<script src="/static/lib/layui/layui.js" charset="utf-8"></script>
<script src="/static/js/x-layui.js" charset="utf-8"></script>
<script type="text/javascript">
    //实例化编辑器
    //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
    UE.getEditor('content',{initialFrameWidth:600,initialFrameHeight:400,});
</script>
<script>
    layui.use(['element','layer','form'], function(){
        $ = layui.jquery;//jquery
        lement = layui.element();//面包导航
        layer = layui.layer;//弹出层
        form = layui.form();



        //图片上传接口
        /*layui.upload({
          url: './upload.json' //上传接口
          ,success: function(res){ //上传成功后的回调
              console.log(res);
            $('#LAY_demo_upload').attr('src',res.url);
          }
        });*/


        //监听提交
        form.on('submit(add)', function(data){
            var title=$("input[name='title']").val();
            //var content=$("textarea[name='content']").val();

            var article_category_id=$('#article_category_id option:selected') .val();//所属文章类型
            //alert(title);
            //var form=$("#cate_add").serialize();
            if(title==""){
                layer.msg('文章标题不能为空',{icon:5,time:2000});return false;
            }
            if(article_category_id==""){
                layer.msg('文章类型不能为空',{icon:5,time:2000});return false;
            }
            /*if(content){
                layer.msg("文章内容不能为空！",{icon:5,time:2000});return false;
          }*/
            var data = data.field;
            $.ajax({
                type:"post",
                url:"",
                data:data,
                dataType:"json",
                success:function(data){
                    if(data.status==1){
                        layer.msg(data.info, {icon: 6,time:2000},function () {
                            window.parent.location.reload();
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(index);
                        });
                        return false;

                    }else{
                        layer.msg(data.info,{icon:5,time:2000});return false;
                    }
                }

            });

        });

    })
</script>
<!--栏目缩略图上传-->
<script>
    function upload(obj,id){
        var formData = new FormData();
        formData.append('images', $('#previewImg')[0].files[0]);
        formData.append('id', id);//将id追加再id中
        layer.msg('图片上传中', {icon: 16});
        $.ajax({
            type:"post",
            processData: false,
            contentType: false,
            url:"",
            data:formData,
            success:function(data){
                if(data.status == 1){
                    console.log(data.image_name);
                    layer.closeAll('loading');
                    //layer.msg(data.info,{icon:1,time:1000});
                    $("#pimages").attr('src',data.image_name);
                    $("#avatar").val(data.image_name);
                    $(".imgs").show();
                    return false;
                }else{
                    layer.msg(data.info,{icon:2,time:1000});
                }
            }
        });
    }
</script>

</body>
</html>